﻿import gs.TweenLite;
import mx.utils.Delegate;
class cn.eminia.AS2.BoEV3 {
	// Btn od Effect
	function BoEV3(btn:MovieClip, click:Function, vars:Object) {
		var real = btn.real;
		if (real != null) {
			btn.hitArea = real;
			real._alpha = 0;
		}
		// KEEP !!       
		// trace(btn.real)
		var scope = (vars.scope == null) ? btn : vars.scope;
		//trace('BoE  '+this) 
		//
		var over = vars.over;
		var out = vars.out;
		if (over != null) {
			btn._onRollOver = Delegate.create(scope, over);
		}
		if (out != null) {
			btn._onRollOut = Delegate.create(scope, out);
		}
		if (click != null) {
			btn._onRelease = Delegate.create(scope, click);
		}
		btn.onRollOver = function() { 
			this._onRollOver({id:cn.eminia.AS2.BoGV3.getLastID(this._name),oo:this});
			this.gotoAndPlay('s1'); 
		};
		btn.onRollOut = btn.onReleaseOutside=function () { 
			this._onRollOut({id:cn.eminia.AS2.BoGV3.getLastID(this._name),oo:this});
			this.gotoAndPlay('s2');
		}; 
		btn.onRelease = function (evt) { 
			this._onRelease({id:cn.eminia.AS2.BoGV3.getLastID(this._name),oo:this});  
		}; 
		// additional attributes
		if (vars != null) {
			for (var i in vars) {
				btn[i] = vars[i];
			}
		}
	}
	static function s(link_id:String) {
		var _s = new Sound();
		_s.attachSound(link_id);
		_s.start(0, 1);
	}
}
